gems and flatstrap basic layout

jamesperet 9 years ago
parent
commit
4838754d6d
34 changed files with 1148 additions and 22 deletions
  1. 11 3
      Gemfile
  2. 53 7
      Gemfile.lock
  3. 1 0
      app/assets/javascripts/application.js
  4. 3 0
      app/assets/javascripts/bootstrap.js.coffee
  5. 1 0
      app/assets/stylesheets/application.css
  6. 34 0
      app/assets/stylesheets/bootstrap_and_overrides.css.less
  7. 6 0
      app/models/user.rb
  8. 16 0
      app/views/devise/confirmations/new.html.erb
  9. 5 0
      app/views/devise/mailer/confirmation_instructions.html.erb
  10. 8 0
      app/views/devise/mailer/reset_password_instructions.html.erb
  11. 7 0
      app/views/devise/mailer/unlock_instructions.html.erb
  12. 19 0
      app/views/devise/passwords/edit.html.erb
  13. 15 0
      app/views/devise/passwords/new.html.erb
  14. 27 0
      app/views/devise/registrations/edit.html.erb
  15. 17 0
      app/views/devise/registrations/new.html.erb
  16. 15 0
      app/views/devise/sessions/new.html.erb
  17. 25 0
      app/views/devise/shared/_links.erb
  18. 16 0
      app/views/devise/unlocks/new.html.erb
  19. 85 12
      app/views/layouts/application.html.erb
  20. 4 0
      config/environments/development.rb
  21. 256 0
      config/initializers/devise.rb
  22. 88 0
      config/initializers/friendly_id.rb
  23. 145 0
      config/initializers/simple_form.rb
  24. 45 0
      config/initializers/simple_form_bootstrap.rb
  25. 59 0
      config/locales/devise.en.yml
  26. 18 0
      config/locales/en.bootstrap.yml
  27. 26 0
      config/locales/simple_form.en.yml
  28. 1 0
      config/routes.rb
  29. 15 0
      db/migrate/20140916035417_create_friendly_id_slugs.rb
  30. 44 0
      db/migrate/20140916035845_devise_create_users.rb
  31. 52 0
      db/schema.rb
  32. 13 0
      lib/templates/erb/scaffold/_form.html.erb
  33. 11 0
      test/fixtures/users.yml
  34. 7 0
      test/models/user_test.rb

+ 11 - 3
Gemfile

@@ -6,9 +6,6 @@ gem 'rails', '4.0.4'
6 6
 # Use postgresql as the database for Active Record
7 7
 gem 'pg'
8 8
 
9
-# Use SCSS for stylesheets
10
-gem 'sass-rails', '~> 4.0.2'
11
-
12 9
 # Use Uglifier as compressor for JavaScript assets
13 10
 gem 'uglifier', '>= 1.3.0'
14 11
 
@@ -32,6 +29,17 @@ group :doc do
32 29
   gem 'sdoc', require: false
33 30
 end
34 31
 
32
+gem "therubyracer"
33
+gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
34
+gem 'flatstrap-rails'
35
+gem 'bootstrap-timepicker-rails'
36
+gem 'simple_form'
37
+gem 'friendly_id', '~> 5.0.0'
38
+gem 'devise'
39
+gem "letter_opener", :group => :development
40
+gem 'redcarpet'
41
+gem 'summernote-rails'
42
+
35 43
 # Use ActiveModel has_secure_password
36 44
 # gem 'bcrypt', '~> 3.1.7'
37 45
 

+ 53 - 7
Gemfile.lock

@@ -25,7 +25,11 @@ GEM
25 25
       multi_json (~> 1.3)
26 26
       thread_safe (~> 0.1)
27 27
       tzinfo (~> 0.3.37)
28
+    addressable (2.3.6)
28 29
     arel (4.0.2)
30
+    bcrypt (3.1.7)
31
+    bootstrap-timepicker-rails (0.1.3)
32
+      railties (>= 3.0)
29 33
     builder (3.1.4)
30 34
     coffee-rails (4.0.1)
31 35
       coffee-script (>= 2.2.0)
@@ -34,8 +38,19 @@ GEM
34 38
       coffee-script-source
35 39
       execjs
36 40
     coffee-script-source (1.8.0)
41
+    commonjs (0.2.7)
42
+    devise (3.2.4)
43
+      bcrypt (~> 3.0)
44
+      orm_adapter (~> 0.1)
45
+      railties (>= 3.2.6, < 5)
46
+      thread_safe (~> 0.1)
47
+      warden (~> 1.2.3)
37 48
     erubis (2.7.0)
38 49
     execjs (2.2.1)
50
+    flatstrap-rails (0.3.0.2)
51
+      twitter-bootstrap-rails (~> 2.2.6)
52
+    friendly_id (5.0.4)
53
+      activerecord (>= 4.0.0)
39 54
     hike (1.2.3)
40 55
     i18n (0.6.11)
41 56
     jbuilder (1.5.3)
@@ -45,12 +60,23 @@ GEM
45 60
       railties (>= 3.0, < 5.0)
46 61
       thor (>= 0.14, < 2.0)
47 62
     json (1.8.1)
63
+    launchy (2.4.2)
64
+      addressable (~> 2.3)
65
+    less (2.5.0)
66
+      commonjs (~> 0.2.7)
67
+    less-rails (2.5.0)
68
+      actionpack (>= 3.1)
69
+      less (~> 2.5.0)
70
+    letter_opener (1.2.0)
71
+      launchy (~> 2.2)
72
+    libv8 (3.16.14.3)
48 73
     mail (2.5.4)
49 74
       mime-types (~> 1.16)
50 75
       treetop (~> 1.4.8)
51 76
     mime-types (1.25.1)
52 77
     minitest (4.7.5)
53 78
     multi_json (1.10.1)
79
+    orm_adapter (0.5.0)
54 80
     pg (0.17.1)
55 81
     polyglot (0.3.5)
56 82
     rack (1.5.2)
@@ -72,15 +98,14 @@ GEM
72 98
     rake (10.3.2)
73 99
     rdoc (4.1.2)
74 100
       json (~> 1.4)
75
-    sass (3.2.19)
76
-    sass-rails (4.0.3)
77
-      railties (>= 4.0.0, < 5.0)
78
-      sass (~> 3.2.0)
79
-      sprockets (~> 2.8, <= 2.11.0)
80
-      sprockets-rails (~> 2.0)
101
+    redcarpet (3.1.2)
102
+    ref (1.0.5)
81 103
     sdoc (0.4.1)
82 104
       json (~> 1.7, >= 1.7.7)
83 105
       rdoc (~> 4.0)
106
+    simple_form (3.0.2)
107
+      actionpack (~> 4.0)
108
+      activemodel (~> 4.0)
84 109
     sprockets (2.11.0)
85 110
       hike (~> 1.2)
86 111
       multi_json (~> 1.0)
@@ -90,6 +115,11 @@ GEM
90 115
       actionpack (>= 3.0)
91 116
       activesupport (>= 3.0)
92 117
       sprockets (~> 2.8)
118
+    summernote-rails (0.4.0)
119
+      railties (>= 3.1)
120
+    therubyracer (0.12.1)
121
+      libv8 (~> 3.16.14.0)
122
+      ref
93 123
     thor (0.19.1)
94 124
     thread_safe (0.3.4)
95 125
     tilt (1.4.1)
@@ -98,21 +128,37 @@ GEM
98 128
       polyglot (>= 0.3.1)
99 129
     turbolinks (2.3.0)
100 130
       coffee-rails
131
+    twitter-bootstrap-rails (2.2.8)
132
+      actionpack (>= 3.1)
133
+      execjs
134
+      rails (>= 3.1)
135
+      railties (>= 3.1)
101 136
     tzinfo (0.3.41)
102 137
     uglifier (2.5.3)
103 138
       execjs (>= 0.3.0)
104 139
       json (>= 1.8.0)
140
+    warden (1.2.3)
141
+      rack (>= 1.0)
105 142
 
106 143
 PLATFORMS
107 144
   ruby
108 145
 
109 146
 DEPENDENCIES
147
+  bootstrap-timepicker-rails
110 148
   coffee-rails (~> 4.0.0)
149
+  devise
150
+  flatstrap-rails
151
+  friendly_id (~> 5.0.0)
111 152
   jbuilder (~> 1.2)
112 153
   jquery-rails
154
+  less-rails
155
+  letter_opener
113 156
   pg
114 157
   rails (= 4.0.4)
115
-  sass-rails (~> 4.0.2)
158
+  redcarpet
116 159
   sdoc
160
+  simple_form
161
+  summernote-rails
162
+  therubyracer
117 163
   turbolinks
118 164
   uglifier (>= 1.3.0)

+ 1 - 0
app/assets/javascripts/application.js

@@ -12,5 +12,6 @@
12 12
 //
13 13
 //= require jquery
14 14
 //= require jquery_ujs
15
+//= require twitter/bootstrap
15 16
 //= require turbolinks
16 17
 //= require_tree .

+ 3 - 0
app/assets/javascripts/bootstrap.js.coffee

@@ -0,0 +1,3 @@
1
+jQuery ->
2
+  $("a[rel~=popover], .has-popover").popover()
3
+  $("a[rel~=tooltip], .has-tooltip").tooltip()

+ 1 - 0
app/assets/stylesheets/application.css

@@ -9,5 +9,6 @@
9 9
  * compiled file, but it's generally better to create a new file per style scope.
10 10
  *
11 11
  *= require_self
12
+ *= require flatstrap/bootstrap
12 13
  *= require_tree .
13 14
  */

+ 34 - 0
app/assets/stylesheets/bootstrap_and_overrides.css.less

@@ -0,0 +1,34 @@
1
+//@import "twitter/bootstrap/bootstrap";
2
+@import "twitter/bootstrap/responsive";
3
+
4
+// Set the correct sprite paths
5
+@iconSpritePath: image-url("twitter/bootstrap/glyphicons-halflings.png");
6
+@iconWhiteSpritePath: image-url("twitter/bootstrap/glyphicons-halflings-white.png");
7
+
8
+// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
9
+@fontAwesomeEotPath: asset-url("fontawesome-webfont.eot");
10
+@fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix");
11
+@fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff");
12
+@fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf");
13
+@fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular");
14
+
15
+// Font Awesome
16
+@import "fontawesome/font-awesome";
17
+
18
+// Glyphicons
19
+//@import "twitter/bootstrap/sprites.less";
20
+
21
+// Your custom LESS stylesheets goes here
22
+//
23
+// Since bootstrap was imported above you have access to its mixins which
24
+// you may use and inherit here
25
+//
26
+// If you'd like to override bootstrap's own variables, you can do so here as well
27
+// See http://twitter.github.com/bootstrap/customize.html#variables for their names and documentation
28
+//
29
+// Example:
30
+// @linkColor: #ff0000;
31
+
32
+.top-container {
33
+	margin-top: 60px;
34
+}

+ 6 - 0
app/models/user.rb

@@ -0,0 +1,6 @@
1
+class User < ActiveRecord::Base
2
+  # Include default devise modules. Others available are:
3
+  # :confirmable, :lockable, :timeoutable and :omniauthable
4
+  devise :database_authenticatable, :registerable,
5
+         :recoverable, :rememberable, :trackable, :validatable
6
+end

+ 16 - 0
app/views/devise/confirmations/new.html.erb

@@ -0,0 +1,16 @@
1
+<h2>Resend confirmation instructions</h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4
+  <%= f.error_notification %>
5
+  <%= f.full_error :confirmation_token %>
6
+
7
+  <div class="form-inputs">
8
+    <%= f.input :email, required: true, autofocus: true %>
9
+  </div>
10
+
11
+  <div class="form-actions">
12
+    <%= f.button :submit, "Resend confirmation instructions" %>
13
+  </div>
14
+<% end %>
15
+
16
+<%= render "devise/shared/links" %>

+ 5 - 0
app/views/devise/mailer/confirmation_instructions.html.erb

@@ -0,0 +1,5 @@
1
+<p>Welcome <%= @email %>!</p>
2
+
3
+<p>You can confirm your account email through the link below:</p>
4
+
5
+<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>

+ 8 - 0
app/views/devise/mailer/reset_password_instructions.html.erb

@@ -0,0 +1,8 @@
1
+<p>Hello <%= @resource.email %>!</p>
2
+
3
+<p>Someone has requested a link to change your password. You can do this through the link below.</p>
4
+
5
+<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
6
+
7
+<p>If you didn't request this, please ignore this email.</p>
8
+<p>Your password won't change until you access the link above and create a new one.</p>

+ 7 - 0
app/views/devise/mailer/unlock_instructions.html.erb

@@ -0,0 +1,7 @@
1
+<p>Hello <%= @resource.email %>!</p>
2
+
3
+<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
4
+
5
+<p>Click the link below to unlock your account:</p>
6
+
7
+<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>

+ 19 - 0
app/views/devise/passwords/edit.html.erb

@@ -0,0 +1,19 @@
1
+<h2>Change your password</h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
4
+  <%= f.error_notification %>
5
+
6
+  <%= f.input :reset_password_token, as: :hidden %>
7
+  <%= f.full_error :reset_password_token %>
8
+
9
+  <div class="form-inputs">
10
+    <%= f.input :password, label: "New password", required: true, autofocus: true %>
11
+    <%= f.input :password_confirmation, label: "Confirm your new password", required: true %>
12
+  </div>
13
+
14
+  <div class="form-actions">
15
+    <%= f.button :submit, "Change my password" %>
16
+  </div>
17
+<% end %>
18
+
19
+<%= render "devise/shared/links" %>

+ 15 - 0
app/views/devise/passwords/new.html.erb

@@ -0,0 +1,15 @@
1
+<h2>Forgot your password?</h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
4
+  <%= f.error_notification %>
5
+
6
+  <div class="form-inputs">
7
+    <%= f.input :email, required: true, autofocus: true %>
8
+  </div>
9
+
10
+  <div class="form-actions">
11
+    <%= f.button :submit, "Send me reset password instructions" %>
12
+  </div>
13
+<% end %>
14
+
15
+<%= render "devise/shared/links" %>

+ 27 - 0
app/views/devise/registrations/edit.html.erb

@@ -0,0 +1,27 @@
1
+<h2>Edit <%= resource_name.to_s.humanize %></h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4
+  <%= f.error_notification %>
5
+
6
+  <div class="form-inputs">
7
+    <%= f.input :email, required: true, autofocus: true %>
8
+
9
+    <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
10
+      <p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p>
11
+    <% end %>
12
+
13
+    <%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %>
14
+    <%= f.input :password_confirmation, required: false %>
15
+    <%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %>
16
+  </div>
17
+
18
+  <div class="form-actions">
19
+    <%= f.button :submit, "Update" %>
20
+  </div>
21
+<% end %>
22
+
23
+<h3>Cancel my account</h3>
24
+
25
+<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
26
+
27
+<%= link_to "Back", :back %>

+ 17 - 0
app/views/devise/registrations/new.html.erb

@@ -0,0 +1,17 @@
1
+<h2>Sign up</h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
4
+  <%= f.error_notification %>
5
+
6
+  <div class="form-inputs">
7
+    <%= f.input :email, required: true, autofocus: true %>
8
+    <%= f.input :password, required: true %>
9
+    <%= f.input :password_confirmation, required: true %>
10
+  </div>
11
+
12
+  <div class="form-actions">
13
+    <%= f.button :submit, "Sign up" %>
14
+  </div>
15
+<% end %>
16
+
17
+<%= render "devise/shared/links" %>

+ 15 - 0
app/views/devise/sessions/new.html.erb

@@ -0,0 +1,15 @@
1
+<h2>Sign in</h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
4
+  <div class="form-inputs">
5
+    <%= f.input :email, required: false, autofocus: true %>
6
+    <%= f.input :password, required: false %>
7
+    <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
8
+  </div>
9
+
10
+  <div class="form-actions">
11
+    <%= f.button :submit, "Sign in" %>
12
+  </div>
13
+<% end %>
14
+
15
+<%= render "devise/shared/links" %>

+ 25 - 0
app/views/devise/shared/_links.erb

@@ -0,0 +1,25 @@
1
+<%- if controller_name != 'sessions' %>
2
+  <%= link_to "Sign in", new_session_path(resource_name) %><br />
3
+<% end -%>
4
+
5
+<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
+  <%= link_to "Sign up", new_registration_path(resource_name) %><br />
7
+<% end -%>
8
+
9
+<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10
+  <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
11
+<% end -%>
12
+
13
+<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
+  <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
15
+<% end -%>
16
+
17
+<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
+  <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
19
+<% end -%>
20
+
21
+<%- if devise_mapping.omniauthable? %>
22
+  <%- resource_class.omniauth_providers.each do |provider| %>
23
+    <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
24
+  <% end -%>
25
+<% end -%>

+ 16 - 0
app/views/devise/unlocks/new.html.erb

@@ -0,0 +1,16 @@
1
+<h2>Resend unlock instructions</h2>
2
+
3
+<%= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4
+  <%= f.error_notification %>
5
+  <%= f.full_error :unlock_token %>
6
+
7
+  <div class="form-inputs">
8
+    <%= f.input :email, required: true, autofocus: true %>
9
+  </div>
10
+
11
+  <div class="form-actions">
12
+    <%= f.button :submit, "Resend unlock instructions" %>
13
+  </div>
14
+<% end %>
15
+
16
+<%= render "devise/shared/links" %>

+ 85 - 12
app/views/layouts/application.html.erb

@@ -1,14 +1,87 @@
1 1
 <!DOCTYPE html>
2
-<html>
3
-<head>
4
-  <title>RailsWebsiteTemplate</title>
5
-  <%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true %>
6
-  <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
-  <%= csrf_meta_tags %>
8
-</head>
9
-<body>
10
-
11
-<%= yield %>
12
-
13
-</body>
2
+<html lang="en">
3
+  <head>
4
+    <meta charset="utf-8">
5
+    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
6
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+    <title><%= content_for?(:title) ? yield(:title) : "RailsWebsiteTemplate" %></title>
8
+    <%= csrf_meta_tags %>
9
+
10
+    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
11
+    <!--[if lt IE 9]>
12
+      <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js" type="text/javascript"></script>
13
+    <![endif]-->
14
+
15
+    <%= stylesheet_link_tag "application", :media => "all" %>
16
+
17
+    <!-- For third-generation iPad with high-resolution Retina display: -->
18
+    <!-- Size should be 144 x 144 pixels -->
19
+    <%= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
20
+
21
+    <!-- For iPhone with high-resolution Retina display: -->
22
+    <!-- Size should be 114 x 114 pixels -->
23
+    <%= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %>
24
+
25
+    <!-- For first- and second-generation iPad: -->
26
+    <!-- Size should be 72 x 72 pixels -->
27
+    <%= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %>
28
+
29
+    <!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
30
+    <!-- Size should be 57 x 57 pixels -->
31
+    <%= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %>
32
+
33
+    <!-- For all other devices -->
34
+    <!-- Size should be 32 x 32 pixels -->
35
+    <%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %>
36
+
37
+    <%= javascript_include_tag "application" %>
38
+  </head>
39
+  <body>
40
+
41
+    <div class="navbar navbar-fixed-top">
42
+      <div class="navbar-inner">
43
+        <div class="container">
44
+          <a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
45
+            <span class="icon-bar"></span>
46
+            <span class="icon-bar"></span>
47
+            <span class="icon-bar"></span>
48
+          </a>
49
+          <a class="brand" href="#">RailsWebsiteTemplate</a>
50
+          <div class="container nav-collapse">
51
+            <ul class="nav">
52
+              <li><%= link_to "Link1", "/path1"  %></li>
53
+              <li><%= link_to "Link2", "/path2"  %></li>
54
+              <li><%= link_to "Link3", "/path3"  %></li>
55
+            </ul>
56
+          </div><!--/.nav-collapse -->
57
+        </div>
58
+      </div>
59
+    </div>
60
+
61
+    <div class="container top-container ">
62
+        <div class="row">
63
+          <div class="span9">
64
+            <%= bootstrap_flash %>
65
+            <%= yield %>
66
+          </div>
67
+          <div class="span3">
68
+            <div class="well sidebar-nav">
69
+              <h3>Sidebar</h3>
70
+              <ul class="nav nav-list">
71
+                <li class="nav-header">Sidebar</li>
72
+                <li><%= link_to "Link1", "/path1"  %></li>
73
+                <li><%= link_to "Link2", "/path2"  %></li>
74
+                <li><%= link_to "Link3", "/path3"  %></li>
75
+              </ul>
76
+            </div><!--/.well -->
77
+          </div><!--/span-->
78
+        </div><!--/row-->
79
+
80
+      <footer>
81
+        <p>&copy; Company 2014</p>
82
+      </footer>
83
+
84
+    </div> <!-- /container -->
85
+
86
+  </body>
14 87
 </html>

+ 4 - 0
config/environments/development.rb

@@ -26,4 +26,8 @@ RailsWebsiteTemplate::Application.configure do
26 26
   # This option may cause significant delays in view rendering with a large
27 27
   # number of complex assets.
28 28
   config.assets.debug = true
29
+  
30
+  config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
31
+  config.action_mailer.delivery_method = :letter_opener
32
+  
29 33
 end

+ 256 - 0
config/initializers/devise.rb

@@ -0,0 +1,256 @@
1
+# Use this hook to configure devise mailer, warden hooks and so forth.
2
+# Many of these configuration options can be set straight in your model.
3
+Devise.setup do |config|
4
+  # The secret key used by Devise. Devise uses this key to generate
5
+  # random tokens. Changing this key will render invalid all existing
6
+  # confirmation, reset password and unlock tokens in the database.
7
+  # config.secret_key = '50e30827b76a62a2b2ab7795d9efe46f82622fd6191484860f76b0312cd4c217cf0bc238ac53670e732852a2c1044d392ade3ada93afd2a92bb57d0d32628241'
8
+
9
+  # ==> Mailer Configuration
10
+  # Configure the e-mail address which will be shown in Devise::Mailer,
11
+  # note that it will be overwritten if you use your own mailer class
12
+  # with default "from" parameter.
13
+  config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
14
+
15
+  # Configure the class responsible to send e-mails.
16
+  # config.mailer = 'Devise::Mailer'
17
+
18
+  # ==> ORM configuration
19
+  # Load and configure the ORM. Supports :active_record (default) and
20
+  # :mongoid (bson_ext recommended) by default. Other ORMs may be
21
+  # available as additional gems.
22
+  require 'devise/orm/active_record'
23
+
24
+  # ==> Configuration for any authentication mechanism
25
+  # Configure which keys are used when authenticating a user. The default is
26
+  # just :email. You can configure it to use [:username, :subdomain], so for
27
+  # authenticating a user, both parameters are required. Remember that those
28
+  # parameters are used only when authenticating and not when retrieving from
29
+  # session. If you need permissions, you should implement that in a before filter.
30
+  # You can also supply a hash where the value is a boolean determining whether
31
+  # or not authentication should be aborted when the value is not present.
32
+  # config.authentication_keys = [ :email ]
33
+
34
+  # Configure parameters from the request object used for authentication. Each entry
35
+  # given should be a request method and it will automatically be passed to the
36
+  # find_for_authentication method and considered in your model lookup. For instance,
37
+  # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
38
+  # The same considerations mentioned for authentication_keys also apply to request_keys.
39
+  # config.request_keys = []
40
+
41
+  # Configure which authentication keys should be case-insensitive.
42
+  # These keys will be downcased upon creating or modifying a user and when used
43
+  # to authenticate or find a user. Default is :email.
44
+  config.case_insensitive_keys = [ :email ]
45
+
46
+  # Configure which authentication keys should have whitespace stripped.
47
+  # These keys will have whitespace before and after removed upon creating or
48
+  # modifying a user and when used to authenticate or find a user. Default is :email.
49
+  config.strip_whitespace_keys = [ :email ]
50
+
51
+  # Tell if authentication through request.params is enabled. True by default.
52
+  # It can be set to an array that will enable params authentication only for the
53
+  # given strategies, for example, `config.params_authenticatable = [:database]` will
54
+  # enable it only for database (email + password) authentication.
55
+  # config.params_authenticatable = true
56
+
57
+  # Tell if authentication through HTTP Auth is enabled. False by default.
58
+  # It can be set to an array that will enable http authentication only for the
59
+  # given strategies, for example, `config.http_authenticatable = [:database]` will
60
+  # enable it only for database authentication. The supported strategies are:
61
+  # :database      = Support basic authentication with authentication key + password
62
+  # config.http_authenticatable = false
63
+
64
+  # If http headers should be returned for AJAX requests. True by default.
65
+  # config.http_authenticatable_on_xhr = true
66
+
67
+  # The realm used in Http Basic Authentication. 'Application' by default.
68
+  # config.http_authentication_realm = 'Application'
69
+
70
+  # It will change confirmation, password recovery and other workflows
71
+  # to behave the same regardless if the e-mail provided was right or wrong.
72
+  # Does not affect registerable.
73
+  # config.paranoid = true
74
+
75
+  # By default Devise will store the user in session. You can skip storage for
76
+  # particular strategies by setting this option.
77
+  # Notice that if you are skipping storage for all authentication paths, you
78
+  # may want to disable generating routes to Devise's sessions controller by
79
+  # passing skip: :sessions to `devise_for` in your config/routes.rb
80
+  config.skip_session_storage = [:http_auth]
81
+
82
+  # By default, Devise cleans up the CSRF token on authentication to
83
+  # avoid CSRF token fixation attacks. This means that, when using AJAX
84
+  # requests for sign in and sign up, you need to get a new CSRF token
85
+  # from the server. You can disable this option at your own risk.
86
+  # config.clean_up_csrf_token_on_authentication = true
87
+
88
+  # ==> Configuration for :database_authenticatable
89
+  # For bcrypt, this is the cost for hashing the password and defaults to 10. If
90
+  # using other encryptors, it sets how many times you want the password re-encrypted.
91
+  #
92
+  # Limiting the stretches to just one in testing will increase the performance of
93
+  # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
94
+  # a value less than 10 in other environments. Note that, for bcrypt (the default
95
+  # encryptor), the cost increases exponentially with the number of stretches (e.g.
96
+  # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
97
+  config.stretches = Rails.env.test? ? 1 : 10
98
+
99
+  # Setup a pepper to generate the encrypted password.
100
+  # config.pepper = 'db05f34b2f36e0e162d8f4006bc6d1dcb07508df7331a36ba79045b6635bdb39eb00b50754a454b42f399894aba335313b9f154f7027399d8e696dbbf739a47c'
101
+
102
+  # ==> Configuration for :confirmable
103
+  # A period that the user is allowed to access the website even without
104
+  # confirming their account. For instance, if set to 2.days, the user will be
105
+  # able to access the website for two days without confirming their account,
106
+  # access will be blocked just in the third day. Default is 0.days, meaning
107
+  # the user cannot access the website without confirming their account.
108
+  # config.allow_unconfirmed_access_for = 2.days
109
+
110
+  # A period that the user is allowed to confirm their account before their
111
+  # token becomes invalid. For example, if set to 3.days, the user can confirm
112
+  # their account within 3 days after the mail was sent, but on the fourth day
113
+  # their account can't be confirmed with the token any more.
114
+  # Default is nil, meaning there is no restriction on how long a user can take
115
+  # before confirming their account.
116
+  # config.confirm_within = 3.days
117
+
118
+  # If true, requires any email changes to be confirmed (exactly the same way as
119
+  # initial account confirmation) to be applied. Requires additional unconfirmed_email
120
+  # db field (see migrations). Until confirmed, new email is stored in
121
+  # unconfirmed_email column, and copied to email column on successful confirmation.
122
+  config.reconfirmable = true
123
+
124
+  # Defines which key will be used when confirming an account
125
+  # config.confirmation_keys = [ :email ]
126
+
127
+  # ==> Configuration for :rememberable
128
+  # The time the user will be remembered without asking for credentials again.
129
+  # config.remember_for = 2.weeks
130
+
131
+  # If true, extends the user's remember period when remembered via cookie.
132
+  # config.extend_remember_period = false
133
+
134
+  # Options to be passed to the created cookie. For instance, you can set
135
+  # secure: true in order to force SSL only cookies.
136
+  # config.rememberable_options = {}
137
+
138
+  # ==> Configuration for :validatable
139
+  # Range for password length.
140
+  config.password_length = 8..128
141
+
142
+  # Email regex used to validate email formats. It simply asserts that
143
+  # one (and only one) @ exists in the given string. This is mainly
144
+  # to give user feedback and not to assert the e-mail validity.
145
+  # config.email_regexp = /\A[^@]+@[^@]+\z/
146
+
147
+  # ==> Configuration for :timeoutable
148
+  # The time you want to timeout the user session without activity. After this
149
+  # time the user will be asked for credentials again. Default is 30 minutes.
150
+  # config.timeout_in = 30.minutes
151
+
152
+  # If true, expires auth token on session timeout.
153
+  # config.expire_auth_token_on_timeout = false
154
+
155
+  # ==> Configuration for :lockable
156
+  # Defines which strategy will be used to lock an account.
157
+  # :failed_attempts = Locks an account after a number of failed attempts to sign in.
158
+  # :none            = No lock strategy. You should handle locking by yourself.
159
+  # config.lock_strategy = :failed_attempts
160
+
161
+  # Defines which key will be used when locking and unlocking an account
162
+  # config.unlock_keys = [ :email ]
163
+
164
+  # Defines which strategy will be used to unlock an account.
165
+  # :email = Sends an unlock link to the user email
166
+  # :time  = Re-enables login after a certain amount of time (see :unlock_in below)
167
+  # :both  = Enables both strategies
168
+  # :none  = No unlock strategy. You should handle unlocking by yourself.
169
+  # config.unlock_strategy = :both
170
+
171
+  # Number of authentication tries before locking an account if lock_strategy
172
+  # is failed attempts.
173
+  # config.maximum_attempts = 20
174
+
175
+  # Time interval to unlock the account if :time is enabled as unlock_strategy.
176
+  # config.unlock_in = 1.hour
177
+
178
+  # Warn on the last attempt before the account is locked.
179
+  # config.last_attempt_warning = false
180
+
181
+  # ==> Configuration for :recoverable
182
+  #
183
+  # Defines which key will be used when recovering the password for an account
184
+  # config.reset_password_keys = [ :email ]
185
+
186
+  # Time interval you can reset your password with a reset password key.
187
+  # Don't put a too small interval or your users won't have the time to
188
+  # change their passwords.
189
+  config.reset_password_within = 6.hours
190
+
191
+  # ==> Configuration for :encryptable
192
+  # Allow you to use another encryption algorithm besides bcrypt (default). You can use
193
+  # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
194
+  # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
195
+  # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
196
+  # REST_AUTH_SITE_KEY to pepper).
197
+  #
198
+  # Require the `devise-encryptable` gem when using anything other than bcrypt
199
+  # config.encryptor = :sha512
200
+
201
+  # ==> Scopes configuration
202
+  # Turn scoped views on. Before rendering "sessions/new", it will first check for
203
+  # "users/sessions/new". It's turned off by default because it's slower if you
204
+  # are using only default views.
205
+  # config.scoped_views = false
206
+
207
+  # Configure the default scope given to Warden. By default it's the first
208
+  # devise role declared in your routes (usually :user).
209
+  # config.default_scope = :user
210
+
211
+  # Set this configuration to false if you want /users/sign_out to sign out
212
+  # only the current scope. By default, Devise signs out all scopes.
213
+  # config.sign_out_all_scopes = true
214
+
215
+  # ==> Navigation configuration
216
+  # Lists the formats that should be treated as navigational. Formats like
217
+  # :html, should redirect to the sign in page when the user does not have
218
+  # access, but formats like :xml or :json, should return 401.
219
+  #
220
+  # If you have any extra navigational formats, like :iphone or :mobile, you
221
+  # should add them to the navigational formats lists.
222
+  #
223
+  # The "*/*" below is required to match Internet Explorer requests.
224
+  # config.navigational_formats = ['*/*', :html]
225
+
226
+  # The default HTTP method used to sign out a resource. Default is :delete.
227
+  config.sign_out_via = :delete
228
+
229
+  # ==> OmniAuth
230
+  # Add a new OmniAuth provider. Check the wiki for more information on setting
231
+  # up on your models and hooks.
232
+  # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
233
+
234
+  # ==> Warden configuration
235
+  # If you want to use other strategies, that are not supported by Devise, or
236
+  # change the failure app, you can configure them inside the config.warden block.
237
+  #
238
+  # config.warden do |manager|
239
+  #   manager.intercept_401 = false
240
+  #   manager.default_strategies(scope: :user).unshift :some_external_strategy
241
+  # end
242
+
243
+  # ==> Mountable engine configurations
244
+  # When using Devise inside an engine, let's call it `MyEngine`, and this engine
245
+  # is mountable, there are some extra configurations to be taken into account.
246
+  # The following options are available, assuming the engine is mounted as:
247
+  #
248
+  #     mount MyEngine, at: '/my_engine'
249
+  #
250
+  # The router that invoked `devise_for`, in the example above, would be:
251
+  # config.router_name = :my_engine
252
+  #
253
+  # When using omniauth, Devise cannot automatically set Omniauth path,
254
+  # so you need to do it manually. For the users scope, it would be:
255
+  # config.omniauth_path_prefix = '/my_engine/users/auth'
256
+end

+ 88 - 0
config/initializers/friendly_id.rb

@@ -0,0 +1,88 @@
1
+# FriendlyId Global Configuration
2
+#
3
+# Use this to set up shared configuration options for your entire application.
4
+# Any of the configuration options shown here can also be applied to single
5
+# models by passing arguments to the `friendly_id` class method or defining
6
+# methods in your model.
7
+#
8
+# To learn more, check out the guide:
9
+#
10
+# http://norman.github.io/friendly_id/file.Guide.html
11
+
12
+FriendlyId.defaults do |config|
13
+  # ## Reserved Words
14
+  #
15
+  # Some words could conflict with Rails's routes when used as slugs, or are
16
+  # undesirable to allow as slugs. Edit this list as needed for your app.
17
+  config.use :reserved
18
+
19
+  config.reserved_words = %w(new edit index session login logout users admin
20
+    stylesheets assets javascripts images)
21
+
22
+  #  ## Friendly Finders
23
+  #
24
+  # Uncomment this to use friendly finders in all models. By default, if
25
+  # you wish to find a record by its friendly id, you must do:
26
+  #
27
+  #    MyModel.friendly.find('foo')
28
+  #
29
+  # If you uncomment this, you can do:
30
+  #
31
+  #    MyModel.find('foo')
32
+  #
33
+  # This is significantly more convenient but may not be appropriate for
34
+  # all applications, so you must explicity opt-in to this behavior. You can
35
+  # always also configure it on a per-model basis if you prefer.
36
+  #
37
+  # Something else to consider is that using the :finders addon boosts
38
+  # performance because it will avoid Rails-internal code that makes runtime
39
+  # calls to `Module.extend`.
40
+  #
41
+  # config.use :finders
42
+  #
43
+  # ## Slugs
44
+  #
45
+  # Most applications will use the :slugged module everywhere. If you wish
46
+  # to do so, uncomment the following line.
47
+  #
48
+  # config.use :slugged
49
+  #
50
+  # By default, FriendlyId's :slugged addon expects the slug column to be named
51
+  # 'slug', but you can change it if you wish.
52
+  #
53
+  # config.slug_column = 'slug'
54
+  #
55
+  # When FriendlyId can not generate a unique ID from your base method, it appends
56
+  # a UUID, separated by a single dash. You can configure the character used as the
57
+  # separator. If you're upgrading from FriendlyId 4, you may wish to replace this
58
+  # with two dashes.
59
+  #
60
+  # config.sequence_separator = '-'
61
+  #
62
+  #  ## Tips and Tricks
63
+  #
64
+  #  ### Controlling when slugs are generated
65
+  #
66
+  # As of FriendlyId 5.0, new slugs are generated only when the slug field is
67
+  # nil, but if you're using a column as your base method can change this
68
+  # behavior by overriding the `should_generate_new_friendly_id` method that
69
+  # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
70
+  # more like 4.0.
71
+  #
72
+  # config.use Module.new {
73
+  #   def should_generate_new_friendly_id?
74
+  #     slug.blank? || <your_column_name_here>_changed?
75
+  #   end
76
+  # }
77
+  #
78
+  # FriendlyId uses Rails's `parameterize` method to generate slugs, but for
79
+  # languages that don't use the Roman alphabet, that's not usually suffient. Here
80
+  # we use the Babosa library to transliterate Russian Cyrillic slugs to ASCII. If
81
+  # you use this, don't forget to add "babosa" to your Gemfile.
82
+  #
83
+  # config.use Module.new {
84
+  #   def normalize_friendly_id(text)
85
+  #     text.to_slug.normalize! :transliterations => [:russian, :latin]
86
+  #   end
87
+  # }
88
+end

+ 145 - 0
config/initializers/simple_form.rb

@@ -0,0 +1,145 @@
1
+# Use this setup block to configure all options available in SimpleForm.
2
+SimpleForm.setup do |config|
3
+  # Wrappers are used by the form builder to generate a
4
+  # complete input. You can remove any component from the
5
+  # wrapper, change the order or even add your own to the
6
+  # stack. The options given below are used to wrap the
7
+  # whole input.
8
+  config.wrappers :default, class: :input,
9
+    hint_class: :field_with_hint, error_class: :field_with_errors do |b|
10
+    ## Extensions enabled by default
11
+    # Any of these extensions can be disabled for a
12
+    # given input by passing: `f.input EXTENSION_NAME => false`.
13
+    # You can make any of these extensions optional by
14
+    # renaming `b.use` to `b.optional`.
15
+
16
+    # Determines whether to use HTML5 (:email, :url, ...)
17
+    # and required attributes
18
+    b.use :html5
19
+
20
+    # Calculates placeholders automatically from I18n
21
+    # You can also pass a string as f.input placeholder: "Placeholder"
22
+    b.use :placeholder
23
+
24
+    ## Optional extensions
25
+    # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
26
+    # to the input. If so, they will retrieve the values from the model
27
+    # if any exists. If you want to enable the lookup for any of those
28
+    # extensions by default, you can change `b.optional` to `b.use`.
29
+
30
+    # Calculates maxlength from length validations for string inputs
31
+    b.optional :maxlength
32
+
33
+    # Calculates pattern from format validations for string inputs
34
+    b.optional :pattern
35
+
36
+    # Calculates min and max from length validations for numeric inputs
37
+    b.optional :min_max
38
+
39
+    # Calculates readonly automatically from readonly attributes
40
+    b.optional :readonly
41
+
42
+    ## Inputs
43
+    b.use :label_input
44
+    b.use :hint,  wrap_with: { tag: :span, class: :hint }
45
+    b.use :error, wrap_with: { tag: :span, class: :error }
46
+  end
47
+
48
+  # The default wrapper to be used by the FormBuilder.
49
+  config.default_wrapper = :default
50
+
51
+  # Define the way to render check boxes / radio buttons with labels.
52
+  # Defaults to :nested for bootstrap config.
53
+  #   inline: input + label
54
+  #   nested: label > input
55
+  config.boolean_style = :nested
56
+
57
+  # Default class for buttons
58
+  config.button_class = 'btn'
59
+
60
+  # Method used to tidy up errors. Specify any Rails Array method.
61
+  # :first lists the first message for each field.
62
+  # Use :to_sentence to list all errors for each field.
63
+  # config.error_method = :first
64
+
65
+  # Default tag used for error notification helper.
66
+  config.error_notification_tag = :div
67
+
68
+  # CSS class to add for error notification helper.
69
+  config.error_notification_class = 'alert alert-error'
70
+
71
+  # ID to add for error notification helper.
72
+  # config.error_notification_id = nil
73
+
74
+  # Series of attempts to detect a default label method for collection.
75
+  # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
76
+
77
+  # Series of attempts to detect a default value method for collection.
78
+  # config.collection_value_methods = [ :id, :to_s ]
79
+
80
+  # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
81
+  # config.collection_wrapper_tag = nil
82
+
83
+  # You can define the class to use on all collection wrappers. Defaulting to none.
84
+  # config.collection_wrapper_class = nil
85
+
86
+  # You can wrap each item in a collection of radio/check boxes with a tag,
87
+  # defaulting to :span. Please note that when using :boolean_style = :nested,
88
+  # SimpleForm will force this option to be a label.
89
+  # config.item_wrapper_tag = :span
90
+
91
+  # You can define a class to use in all item wrappers. Defaulting to none.
92
+  # config.item_wrapper_class = nil
93
+
94
+  # How the label text should be generated altogether with the required text.
95
+  # config.label_text = lambda { |label, required| "#{required} #{label}" }
96
+
97
+  # You can define the class to use on all labels. Default is nil.
98
+  config.label_class = 'control-label'
99
+
100
+  # You can define the class to use on all forms. Default is simple_form.
101
+  # config.form_class = :simple_form
102
+
103
+  # You can define which elements should obtain additional classes
104
+  # config.generate_additional_classes_for = [:wrapper, :label, :input]
105
+
106
+  # Whether attributes are required by default (or not). Default is true.
107
+  # config.required_by_default = true
108
+
109
+  # Tell browsers whether to use the native HTML5 validations (novalidate form option).
110
+  # These validations are enabled in SimpleForm's internal config but disabled by default
111
+  # in this configuration, which is recommended due to some quirks from different browsers.
112
+  # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
113
+  # change this configuration to true.
114
+  config.browser_validations = false
115
+
116
+  # Collection of methods to detect if a file type was given.
117
+  # config.file_methods = [ :mounted_as, :file?, :public_filename ]
118
+
119
+  # Custom mappings for input types. This should be a hash containing a regexp
120
+  # to match as key, and the input type that will be used when the field name
121
+  # matches the regexp as value.
122
+  # config.input_mappings = { /count/ => :integer }
123
+
124
+  # Custom wrappers for input types. This should be a hash containing an input
125
+  # type as key and the wrapper that will be used for all inputs with specified type.
126
+  # config.wrapper_mappings = { string: :prepend }
127
+
128
+  # Default priority for time_zone inputs.
129
+  # config.time_zone_priority = nil
130
+
131
+  # Default priority for country inputs.
132
+  # config.country_priority = nil
133
+
134
+  # When false, do not use translations for labels.
135
+  # config.translate_labels = true
136
+
137
+  # Automatically discover new inputs in Rails' autoload path.
138
+  # config.inputs_discovery = true
139
+
140
+  # Cache SimpleForm inputs discovery
141
+  # config.cache_discovery = !Rails.env.development?
142
+
143
+  # Default class for inputs
144
+  # config.input_class = nil
145
+end

+ 45 - 0
config/initializers/simple_form_bootstrap.rb

@@ -0,0 +1,45 @@
1
+# Use this setup block to configure all options available in SimpleForm.
2
+SimpleForm.setup do |config|
3
+  config.wrappers :bootstrap, tag: 'div', class: 'control-group', error_class: 'error' do |b|
4
+    b.use :html5
5
+    b.use :placeholder
6
+    b.use :label
7
+    b.wrapper tag: 'div', class: 'controls' do |ba|
8
+      ba.use :input
9
+      ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
10
+      ba.use :hint,  wrap_with: { tag: 'p', class: 'help-block' }
11
+    end
12
+  end
13
+
14
+  config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b|
15
+    b.use :html5
16
+    b.use :placeholder
17
+    b.use :label
18
+    b.wrapper tag: 'div', class: 'controls' do |input|
19
+      input.wrapper tag: 'div', class: 'input-prepend' do |prepend|
20
+        prepend.use :input
21
+      end
22
+      input.use :hint,  wrap_with: { tag: 'span', class: 'help-block' }
23
+      input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
24
+    end
25
+  end
26
+
27
+  config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b|
28
+    b.use :html5
29
+    b.use :placeholder
30
+    b.use :label
31
+    b.wrapper tag: 'div', class: 'controls' do |input|
32
+      input.wrapper tag: 'div', class: 'input-append' do |append|
33
+        append.use :input
34
+      end
35
+      input.use :hint,  wrap_with: { tag: 'span', class: 'help-block' }
36
+      input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
37
+    end
38
+  end
39
+
40
+  # Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
41
+  # Check the Bootstrap docs (http://twitter.github.com/bootstrap)
42
+  # to learn about the different styles for forms and inputs,
43
+  # buttons and other elements.
44
+  config.default_wrapper = :bootstrap
45
+end

+ 59 - 0
config/locales/devise.en.yml

@@ -0,0 +1,59 @@
1
+# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+en:
4
+  devise:
5
+    confirmations:
6
+      confirmed: "Your account was successfully confirmed."
7
+      send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
8
+      send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
9
+    failure:
10
+      already_authenticated: "You are already signed in."
11
+      inactive: "Your account is not activated yet."
12
+      invalid: "Invalid email or password."
13
+      locked: "Your account is locked."
14
+      last_attempt: "You have one more attempt before your account will be locked."
15
+      not_found_in_database: "Invalid email or password."
16
+      timeout: "Your session expired. Please sign in again to continue."
17
+      unauthenticated: "You need to sign in or sign up before continuing."
18
+      unconfirmed: "You have to confirm your account before continuing."
19
+    mailer:
20
+      confirmation_instructions:
21
+        subject: "Confirmation instructions"
22
+      reset_password_instructions:
23
+        subject: "Reset password instructions"
24
+      unlock_instructions:
25
+        subject: "Unlock Instructions"
26
+    omniauth_callbacks:
27
+      failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+      success: "Successfully authenticated from %{kind} account."
29
+    passwords:
30
+      no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+      send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
+      send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+      updated: "Your password was changed successfully. You are now signed in."
34
+      updated_not_active: "Your password was changed successfully."
35
+    registrations:
36
+      destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
37
+      signed_up: "Welcome! You have signed up successfully."
38
+      signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+      signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+      signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
41
+      update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
42
+      updated: "You updated your account successfully."
43
+    sessions:
44
+      signed_in: "Signed in successfully."
45
+      signed_out: "Signed out successfully."
46
+    unlocks:
47
+      send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
48
+      send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
49
+      unlocked: "Your account has been unlocked successfully. Please sign in to continue."
50
+  errors:
51
+    messages:
52
+      already_confirmed: "was already confirmed, please try signing in"
53
+      confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
54
+      expired: "has expired, please request a new one"
55
+      not_found: "not found"
56
+      not_locked: "was not locked"
57
+      not_saved:
58
+        one: "1 error prohibited this %{resource} from being saved:"
59
+        other: "%{count} errors prohibited this %{resource} from being saved:"

+ 18 - 0
config/locales/en.bootstrap.yml

@@ -0,0 +1,18 @@
1
+# Sample localization file for English. Add more files in this directory for other locales.
2
+# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+en:
5
+  helpers:
6
+    actions: "Actions"
7
+    links:
8
+      back: "Back"
9
+      cancel: "Cancel"
10
+      confirm: "Are you sure?"
11
+      destroy: "Delete"
12
+      new: "New"
13
+      edit: "Edit"
14
+    titles:
15
+      edit: "Edit %{model}"
16
+      save: "Save %{model}"
17
+      new: "New %{model}"
18
+      delete: "Delete %{model}"

+ 26 - 0
config/locales/simple_form.en.yml

@@ -0,0 +1,26 @@
1
+en:
2
+  simple_form:
3
+    "yes": 'Yes'
4
+    "no": 'No'
5
+    required:
6
+      text: 'required'
7
+      mark: '*'
8
+      # You can uncomment the line below if you need to overwrite the whole required html.
9
+      # When using html, text and mark won't be used.
10
+      # html: '<abbr title="required">*</abbr>'
11
+    error_notification:
12
+      default_message: "Please review the problems below:"
13
+    # Labels and hints examples
14
+    # labels:
15
+    #   defaults:
16
+    #     password: 'Password'
17
+    #   user:
18
+    #     new:
19
+    #       email: 'E-mail to sign in.'
20
+    #     edit:
21
+    #       email: 'E-mail.'
22
+    # hints:
23
+    #   defaults:
24
+    #     username: 'User name to sign in.'
25
+    #     password: 'No special characters, please.'
26
+

+ 1 - 0
config/routes.rb

@@ -1,4 +1,5 @@
1 1
 RailsWebsiteTemplate::Application.routes.draw do
2
+  devise_for :users
2 3
   # The priority is based upon order of creation: first created -> highest priority.
3 4
   # See how all your routes lay out with "rake routes".
4 5
 

+ 15 - 0
db/migrate/20140916035417_create_friendly_id_slugs.rb

@@ -0,0 +1,15 @@
1
+class CreateFriendlyIdSlugs < ActiveRecord::Migration
2
+  def change
3
+    create_table :friendly_id_slugs do |t|
4
+      t.string   :slug,           :null => false
5
+      t.integer  :sluggable_id,   :null => false
6
+      t.string   :sluggable_type, :limit => 50
7
+      t.string   :scope
8
+      t.datetime :created_at
9
+    end
10
+    add_index :friendly_id_slugs, :sluggable_id
11
+    add_index :friendly_id_slugs, [:slug, :sluggable_type]
12
+    add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], :unique => true
13
+    add_index :friendly_id_slugs, :sluggable_type
14
+  end
15
+end

+ 44 - 0
db/migrate/20140916035845_devise_create_users.rb

@@ -0,0 +1,44 @@
1
+class DeviseCreateUsers < ActiveRecord::Migration
2
+  def change
3
+    create_table(:users) do |t|
4
+      ## Database authenticatable
5
+      t.string :email,              null: false, default: ""
6
+      t.string :encrypted_password, null: false, default: ""
7
+
8
+      ## Recoverable
9
+      t.string   :reset_password_token
10
+      t.datetime :reset_password_sent_at
11
+
12
+      ## Rememberable
13
+      t.datetime :remember_created_at
14
+
15
+      ## Trackable
16
+      t.integer  :sign_in_count, default: 0, null: false
17
+      t.datetime :current_sign_in_at
18
+      t.datetime :last_sign_in_at
19
+      t.string   :current_sign_in_ip
20
+      t.string   :last_sign_in_ip
21
+
22
+      ## Confirmable
23
+      # t.string   :confirmation_token
24
+      # t.datetime :confirmed_at
25
+      # t.datetime :confirmation_sent_at
26
+      # t.string   :unconfirmed_email # Only if using reconfirmable
27
+
28
+      ## Lockable
29
+      # t.integer  :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30
+      # t.string   :unlock_token # Only if unlock strategy is :email or :both
31
+      # t.datetime :locked_at
32
+
33
+      t.string :first_name
34
+      t.string :last_name
35
+
36
+      t.timestamps
37
+    end
38
+
39
+    add_index :users, :email,                unique: true
40
+    add_index :users, :reset_password_token, unique: true
41
+    # add_index :users, :confirmation_token,   unique: true
42
+    # add_index :users, :unlock_token,         unique: true
43
+  end
44
+end

+ 52 - 0
db/schema.rb

@@ -0,0 +1,52 @@
1
+# encoding: UTF-8
2
+# This file is auto-generated from the current state of the database. Instead
3
+# of editing this file, please use the migrations feature of Active Record to
4
+# incrementally modify your database, and then regenerate this schema definition.
5
+#
6
+# Note that this schema.rb definition is the authoritative source for your
7
+# database schema. If you need to create the application database on another
8
+# system, you should be using db:schema:load, not running all the migrations
9
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+# you'll amass, the slower it'll run and the greater likelihood for issues).
11
+#
12
+# It's strongly recommended that you check this file into your version control system.
13
+
14
+ActiveRecord::Schema.define(version: 20140916035845) do
15
+
16
+  # These are extensions that must be enabled in order to support this database
17
+  enable_extension "plpgsql"
18
+
19
+  create_table "friendly_id_slugs", force: true do |t|
20
+    t.string   "slug",                      null: false
21
+    t.integer  "sluggable_id",              null: false
22
+    t.string   "sluggable_type", limit: 50
23
+    t.string   "scope"
24
+    t.datetime "created_at"
25
+  end
26
+
27
+  add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree
28
+  add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree
29
+  add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree
30
+  add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree
31
+
32
+  create_table "users", force: true do |t|
33
+    t.string   "email",                  default: "", null: false
34
+    t.string   "encrypted_password",     default: "", null: false
35
+    t.string   "reset_password_token"
36
+    t.datetime "reset_password_sent_at"
37
+    t.datetime "remember_created_at"
38
+    t.integer  "sign_in_count",          default: 0,  null: false
39
+    t.datetime "current_sign_in_at"
40
+    t.datetime "last_sign_in_at"
41
+    t.string   "current_sign_in_ip"
42
+    t.string   "last_sign_in_ip"
43
+    t.string   "first_name"
44
+    t.string   "last_name"
45
+    t.datetime "created_at"
46
+    t.datetime "updated_at"
47
+  end
48
+
49
+  add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
50
+  add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
51
+
52
+end

+ 13 - 0
lib/templates/erb/scaffold/_form.html.erb

@@ -0,0 +1,13 @@
1
+<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
2
+  <%%= f.error_notification %>
3
+
4
+  <div class="form-inputs">
5
+  <%- attributes.each do |attribute| -%>
6
+    <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
7
+  <%- end -%>
8
+  </div>
9
+
10
+  <div class="form-actions">
11
+    <%%= f.button :submit %>
12
+  </div>
13
+<%% end %>

+ 11 - 0
test/fixtures/users.yml

@@ -0,0 +1,11 @@
1
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+# This model initially had no columns defined.  If you add columns to the
4
+# model remove the '{}' from the fixture names and add the columns immediately
5
+# below each fixture, per the syntax in the comments below
6
+#
7
+one: {}
8
+# column: value
9
+#
10
+two: {}
11
+#  column: value

+ 7 - 0
test/models/user_test.rb

@@ -0,0 +1,7 @@
1
+require 'test_helper'
2
+
3
+class UserTest < ActiveSupport::TestCase
4
+  # test "the truth" do
5
+  #   assert true
6
+  # end
7
+end